package com.chendongyang.www.dao;//进行管理者账号的登录
import com.chendongyang.www.po.manager;
import com.mysql.cj.jdbc.Driver;

import java.sql.*;

public class mLogIn {
    public  boolean select(manager manager) throws SQLException {
        // 对输入的管理者账号和密码进行匹配，匹配成功则是登陆成功；
        DriverManager.registerDriver(new Driver());
        Connection root = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/lle", "root", "123456");
        String sql = "select * from manager where id=? and code=?;";
        PreparedStatement preparedStatement = root.prepareStatement(sql);
        preparedStatement.setString(1, manager.getId());
        preparedStatement.setString(2, manager.getCode());
        ResultSet resultSet = preparedStatement.executeQuery();
        boolean result = resultSet.next();
        root.close();
        preparedStatement.close();
        resultSet.close();
        return result;
    }
}
